Matrix Calculator Help Index

The Matrix Calculator is a calculator interface to a numerical linear algebra library written in C++.  This application is designed as a tool for student use in the investigation and evaluation of elementary procedures in numerical linear algebra.  It is hoped that this application will help some students to bridge the gap between calculator usage and use of the more professional versions of linear algebra tools on the PC.  The underlying algorithms are a mix of traditional lower level classical ones and nontraditional higher level algorithms written in near algebraic form.  This application is not intended to support research.

This is a 32bit program and requires Microsoft Win95, Windows NT or Win32s.

Help is available on the following topics

Getting Started

Entering a matrix

Transfer buttons

Solving linear systems

The matrix expression evaluator

Other Buttons

Examples

More About this App

Registration/License

Commands

File menu

View menu

Window menu

Help menu

Print command


File menu commands

The File menu offers the following commands:

New	Creates a new document.
Open	Opens an existing document.
Close	Closes an opened document.
Save	Saves an opened document using the same file name.
Save As	Saves an opened document to a specified file name.
Print	Prints a document.
Print Preview	Displays the document on the screen as it would appear printed.
Print Setup	Selects a printer and printer connection.
Exit	Exits MTRXCALC


Edit menu commands

The Edit menu offers the following commands:

Undo	Reverse previous editing operation.
Cut	Deletes data from the document and moves it to the clipboard.
Copy	Copies data from the document to the clipboard.
Paste	Pastes data from the clipboard into the document.
Paste Link	Pastes from the clipboard a link to data in another application.
Insert New Object	Inserts and embeds an object, such as a chart or an equation in a document.
Links	List and edit links to embedded documents.


View menu commands

The View menu offers the following commands:

Toolbar	Shows or hides the toolbar.
Status Bar	Shows or hides the status bar.


Window menu commands

The Window menu offers the following commands, which enable you to arrange multiple views of multiple documents in the application window:

New Window	Creates a new window that views the same document.
Cascade	Arranges windows in an overlapped fashion.
Tile	Arranges windows in non-overlapped tiles.
Arrange Icons	Arranges icons of closed windows.
Split	Split the active window into panes.
Window 1, 2, ...	Goes to specified window.


Help menu commands

The Help menu offers the following commands, which provide you assistance with this application:

Index	Offers you an index to topics on which you can get help.
Using Help	Provides general instructions on using help.
About	Displays the version number of this application.


File New command
New command (File menu)

Use this command to open the first document in MTRXCALC.  The first document is always the file named NEW.MAT.  This opens an example file used by the help sessions.  You may use the Save_as  to write your own NEW.MAT or your.MAT or whatever but you must leave one file named NEW.MAT

You can open an existing document with the Open command.

Shortcuts

Toolbar:

Keys:	CTRL+N


File New dialog box

Specify the type of document you wish to create:

At present only type *.MAT is supported


File Open command
Open command (File menu)

Use this command to open an existing file/document in a new window.  You can open multiple documents at once, but you must remember that each document has a pair of views.  The upper view of buttons and the lower view of data.  The buttons of one document will not operate on data of another.  Use the Window menu to switch among the multiple open documents.  See Window 1, 2, ... command.

You can reopen the NEW.MAT document any time with the New command.

Shortcuts

Toolbar:

Keys:	CTRL+O


File Open dialog box

The following options allow you to specify which file to open:

File Name

Type or select the filename you want to open.  This box lists files with the extension you select in the List Files of Type box.

List Files of Type

Select the type of file you want to open:

This feature is not available at present

Drives

Select the drive in which MTRXCALC stores the file that you want to open.

Directories

Select the directory in which MTRXCALC stores the file that you want to open.

Network...

Choose this button to connect to a network location, assigning it a new drive letter.


File Close command
Close command (File menu)

Use this command to close all windows containing the active document.  MTRXCALC does not suggest that you save changes to your document before you close it, since in most cases of forseen use that is not desired.  If you do wish to save a matrix result be sure the result is in the display Dlg and use the Save As dialog box

You can also close a document by using the Close icon on the document's window, as shown below:


File Save command
Save command (File menu)

In MTRXCALC your must use the Save As... command to save your files.  This is to prevent accidently overwriting the file NEW.MAT used by the help sessions.


File Save As command
Save As command (File menu)

Use this command to save and name the active document.  MTRXCALC displays the Save As dialog box so you can name your document file ???????.MAT.  Please note that the files saved by MTRXCALC are in a binary format that is meaningless to other applications.


File Save As dialog box

The following options allow you to specify the name and location of the file you're about to save:

File Name

Type a new filename to save a document with a different name.  A filename can contain up to eight characters and an extension of up to three characters. MTRXCALC adds the extension you specify in the Save File As Type box.

Drives

Select the drive in which you want to store the document.

Directories

Select the directory in which you want to store the document.

Network...

Choose this button to connect to a network location, assigning it a new drive letter.


File 1, 2, 3, 4 command
1, 2, 3, 4 command (File menu)

Use the numbers and filenames listed at the bottom of the File menu to open the last four documents you closed.  Choose the number that corresponds with the document you want to open.


File Exit command
Exit command (File menu)

Use this command to end your MTRXCALC session.  You can also use the Close command on the application Control menu. MTRXCALC does not prompt you to save documents with unsaved changes.

Shortcuts

Mouse:	Double-click the application's Control menu button.

Keys:	ALT+F4


Cut command (Edit menu)

Use this command to remove the currently selected data from the document and put it on the clipboard.  This command is unavailable if there is no data currently selected.

Cutting data to the clipboard replaces the contents previously stored there.

Shortcuts

Toolbar:

Keys:	CTRL+X


Copy command (Edit menu)

Use this command to copy selected data onto the clipboard.  This command is unavailable if there is no data currently selected.

Copying data to the clipboard replaces the contents previously stored there.

Shortcuts

Toolbar:

Keys:	CTRL+C


Paste command (Edit menu)

Use this command to insert a copy of the clipboard contents at the insertion point.  This command is unavailable if the clipboard is empty.

Shortcuts

Toolbar:

Keys:	CTRL+V


View Toolbar command
Toolbar command (View menu)

Use this command to display and hide the Toolbar, which includes buttons for some of the most common commands in MTRXCALC, such as File Open.  A check mark appears next to the menu item when the Toolbar is displayed.

See Toolbar for help on using the toolbar.


Toolbar

To hide or display the Toolbar, choose Toolbar from the View menu (ALT, V, T).

Click	To

Open a new document.

Open an existing document. MTRXCALC displays the Open dialog box, in which you can locate and open the desired file.

Save the active document or template with its current name.  If you have not named the document, MTRXCALC displays the Save As dialog box.

Print the active document.

Remove selected data from the document and stores it on the clipboard.

Copy the selection to the clipboard.

Insert the contents of the clipboard at the insertion point.

Reverse the last editing.  Note:  You cannot undo some actions.

Go to the first record in the current selection.

Go to the previous record in the current selection.

Go to the next record in the current selection.

Go to the last record in the current selection.


View Status Bar Command
Status Bar command (View menu)

Use this command to display and hide the Status Bar, which describes the action to be executed by the selected menu item or depressed toolbar button, and keyboard latch state. A check mark appears next to the menu item when the Status Bar is displayed.

See Status Bar for help on using the status bar.


Status Bar

The status bar is displayed at the bottom of the MTRXCALC window.  To display or hide the status bar, use the Status Bar command in the View menu.

The left area of the status bar describes actions of menu items as you use the arrow keys to navigate through menus.  This area similarly shows messages that describe the actions of toolbar buttons as you depress them, before releasing them.  If after viewing the description of the toolbar button command you wish not to execute the command, then release the mouse button while the pointer is off the toolbar button.

The right areas of the status bar indicate which of the following keys are latched down:

Indicator	Description

CAP	The Caps Lock key is latched down.

NUM	The Num Lock key is latched down.

SCRL	The Scroll Lock key is latched down.


New command (Window menu)

Use this command to open a new window with the same contents as the active window.  You can open multiple document windows to display different parts or views of a document at the same time.  If you change the contents in one window, all other windows containing the same document reflect those changes.  When you open a new window, it becomes the active window and is displayed on top of all other open windows.


Cascade command (Window menu)

Use this command to arrange multiple opened windows in an overlapped fashion.


Tile command (Window menu)

Use this command to arrange multiple opened windows in a non-overlapped fashion.


Tile Horizontal command (Window menu)

Use this command to vertically arrange multiple opened windows in a non-overlapped fashion.


Tile Vertical command (Window menu)

Use this command to arrange multiple opened windows side by side.


Window Arrange Icons Command

Use this command to arrange the icons for minimized windows at the bottom of the main window.  If there is an open document window at the bottom of the main window, then some or all of the icons may not be visible because they will be underneath this document window.


Split Command (Window menu)

Use this command to split the active window into panes.  You may then use the mouse or the keyboard arrows to move the splitter bars.  When you are finished, press the mouse button or return to leave the splitter bars in their new location.  Pressing escape keeps the splitter bars in their original location.


1, 2, ... command (Window menu)

MTRXCALC displays a list of currently open document windows at the bottom of the Window menu.  A check mark appears in front of the document name of the active window.  Choose a document from this list to make its window active.


Index command (Help menu)

Use this command to display the opening screen of Help.  From the opening screen, you can jump to step-by-step instructions for using MTRXCALC and various types of reference information.

Once you open Help, you can click the Contents button whenever you want to return to the opening screen.


Using Help command (Help menu)

Use this command for instructions about using Help.


About command (Help menu)

Use this command to display the copyright notice and version number of your copy of MTRXCALC.


Help Using Help Command
Context Help command

Use the Context Help command to obtain help on some portion of MTRXCALC.  When you choose the Toolbar's Context Help button, the mouse pointer will change to an arrow and question mark.  Then click somewhere in the MTRXCALC window, such as another Toolbar button.  The Help topic will be shown for the item you clicked.

Shortcut

Keys:	SHIFT+F1


Title Bar

<< Show your application's title bar here. >>

The title bar is located along the top of a window.  It contains the name of the application and document.

To move the window, drag the title bar.  Note: You can also move dialog boxes by dragging their title bars.

A title bar may contain the following elements:

Application Control-menu button

Document Control-menu button

Maximize button

Minimize button

Name of the application

Name of the document

Restore button


Scroll bars

Displayed at the right and bottom edges of the document window.  The scroll boxes inside the scroll bars indicate your vertical and horizontal location in the document.  You can use the mouse to scroll to other parts of the document.

<< Describe the actions of the various parts of the scrollbar, according to how they behave in your application. >>


Size command (System menu)

Use this command to display a four-headed arrow so you can size the active window with the arrow keys.

After the pointer changes to the four-headed arrow:

1.	Press one of the DIRECTION keys (left, right, up, or down arrow key) to move the pointer to the border you want to move.

2.	Press a DIRECTION key to move the border.

3.	Press ENTER when the window is the size you want.

Note:  This command is unavailable if you maximize the window.

Shortcut

Mouse:	Drag the size bars at the corners or edges of the window.


Move command (Control menu)

Use this command to display a four-headed arrow so you can move the active window or dialog box with the arrow keys.

Note:  This command is unavailable if you maximize the window.

Shortcut

Keys:	CTRL+F7


System Minimize Command
Minimize command (application Control menu)

Use this command to reduce the <<YourApp>> window to an icon.

Shortcut

Mouse:	Click the minimize icon [image] on the title bar.

Keys:	ALT+F9


Maximize command (System menu)

Use this command to enlarge the active window to fill the available space.

Shortcut

Mouse:	Click the maximize icon [image] on the title bar; or double-click the title bar.

Keys:	CTRL+F10 enlarges a document window.


Next Window command (document Control menu)

Use this command to switch to the next open document window.  <<YourApp>> determines which window is next according to the order in which you opened the windows.

Shortcut

Keys:	CTRL+F6


Previous Window command (document Control menu)

Use this command to switch to the previous open document window.  <<YourApp>> determines which window is previous according to the order in which you opened the windows.

Shortcut

Keys:	SHIFT+CTRL+F6


Close command (Control menus)

Use this command to close the active window or dialog box.

Double-clicking a Control-menu box is the same as choosing the Close command.

Note:  If you have multiple windows open for a single document, the Close command on the document Control menu closes only one window at a time.  You can close all windows at once with the Close command on the File menu.

Shortcuts

Keys: 	CTRL+F4 closes a document window

ALT+F4 closes the <<YourType>> window or dialog box


Restore command (Control menu)

Use this command to return the active window to its size and position before you chose the Maximize or Minimize command.


Switch to command (application Control menu)

Use this command to display a list of all open applications.  Use this "Task List" to switch to or close an application on the list.

Shortcut

Keys:	CTRL+ESC

Dialog Box Options

When you choose the Switch To command, you will be presented with a dialog box with the following options:

Task List

Select the application you want to switch to or close.

Switch To

Makes the selected application active.

End Task

Closes the selected application.

Cancel

Closes the Task List box.

Cascade

Arranges open applications so they overlap and you can see each title bar.  This option does not affect applications reduced to icons.

Tile

Arranges open applications into windows that do not overlap.  This option does not affect applications reduced to icons.

Arrange Icons

Arranges the icons of all minimized applications across the bottom of the screen.


Choose Font Dialog
Choose Font dialog box

<< Write application-specific help here. >>


Choose Color Dialog
Choose Color dialog box

<< Write application-specific help here. >>


Edit Clear Command
Clear command (Edit menu)

<< Write application-specific help here. >>


Edit Clear All
Clear All command (Edit menu)

<< Write application-specific help here. >>


Next Pane Command
Next Pane

<< Write application-specific help here. >>


Prev Pane Command
Prev Pane

<< Write application-specific help here. >>


Modifying the Document

<< Write application-specific help here that provides an overview of how the user should modify a document using your application.

If your application supports multiple document types and you want to have a distinct help topic for each, then use the help context i.d. generated by running the MAKEHELP.BAT file produced by AppWizard.  Alternatively, run MAKEHM as follows:

makehm IDR_HIDR_,0x2000 resource.h

If the IDR_ symbol for one of your document types is, for example, IDR_CHARTTYPE, then the help context i.d. generated by MAKEHM will be HIDR_CHARTTYPE.

Note, AppWizard defines the HIDR_DOC1TYPE help context i.d. used by this help topic for the first document type supported by your application.  AppWizard produces an alias in the .HPJ file for your application, mapping HIDR_DOC1TYPE to the HIDR_ produced by MAKEHM for that document type. >>


No Help Available

No help is available for this area of the window.


No Help Available

No help is available for this message box.

<< If you wish to author help specific to each message box prompt, then remove the AFX_HIDP_xxx values from the [ALIAS] section of your .HPJ file, and author a topic for each AFX_HIDP_xxx value.  For example, AFX_HIDP_INVALID_FILENAME is the help topic for the Invalid Filename message box. >>


File Print command
Print command (File menu)

Use this command to print the current matrix in Dlg.  If you wish to print a matrix stored in A, B or etc, first transfer it to Dlg.   This command presents a Print dialog box, where you may specify the number of copies, the destination printer, and other printer setup options.  Please NOTE this application prints in Win NT but does not print on all versions for WIN32s

Shortcuts

Toolbar:

Keys:	CTRL+P


Print dialog box

The following options allow you to specify how the document should be printed:

Printer

This is the active printer and printer connection.  Choose the Setup option to change the printer and printer connection.

Setup

Displays a Print Setup dialog box, so  you can select a printer and printer connection.

Print Range

Specify the pages you want to print:

All	Prints the entire document.
Selection	Prints the currently selected text.
Pages	Prints the range of pages you specify in the From and To boxes.
Copies

Specify the number of copies you want to print for the above page range.

Collate Copies

Prints copies in page number order, instead of separated multiple copies of each page.

Print Quality

Select the quality of the printing.  Generally, lower quality printing takes less time to produce.


Print Progress Dialog

The Printing dialog box is shown during the time that <<YourApp>> is sending output to the printer.  The page number indicates the progress of the printing.

To abort printing, choose Cancel.


File Print Preview command
Print Preview command (File menu)

Use this command to display the active document as it would appear when printed.  When you choose this command, the main window will be replaced with a print preview window in which one or two pages will be displayed in their printed format.  The print preview toolbar offers you options to view either one or two pages at a time; move back and forth through the document; zoom in and out of pages; and initiate a print job.


Print Preview toolbar

The print preview toolbar offers you the following options:

Print

Bring up the print dialog box, to start a print job.

Next Page

Preview the next printed page.

Prev Page

Preview the previous printed page.

One Page / Two Page

Preview one or two printed pages at a time.

Zoom In

Take a closer look at the printed page.

Zoom Out

Take a larger look at the printed page.

Close

Return from print preview to the editing window.


File Print Setup command
Print Setup command (File menu)

Use this command to select a printer and a printer connection.  This command presents a Print Setup dialog box, where you specify the printer and its connection.


Print Setup dialog box

The following options allow you to select the destination printer and its connection.

Printer

Select the printer you want to use.  Choose the Default Printer; or choose the Specific Printer option and select one of the current installed printers shown in the box.  You install printers and configure ports using the Windows Control Panel.

Orientation

Choose Portrait or Landscape.

Paper Size

Select the size of paper that the document is to be printed on.

Paper Source

Some printers offer multiple trays for different paper sources.  Specify the tray here.

Options

Displays a dialog box where you can make additional choices about printing, specific to the type of printer you have selected.

Network...

Choose this button to connect to a network location, assigning it a new drive letter.


File Page Setup Command
Page Setup command (File menu)

<< Write application-specific help here. >>


Getting Started

Any of the standard methods of starting a Windows™, Windows NT™ or Windows 95™ application should work with this application MTRXCALC.EXE but with the following exceptions:  A file provided with this application with filename NEW.MAT must be provided in the same directory as MTRXCALC.EXE  (else you will have to locate it for mtrxcalc.exe each time you start.)

The application opens with two separate views based on Windows dialog boxes.  The starting position of these views(windows) is in a predetermined horizontal tile mode (but slightly overlapped ).  The upper window contains the calculator emulating buttons and is best left in this position I think.  The lower window contains a spread-sheet-like view which performs as the method of input and output.  The two windows should look much like the. bitmap below if your resolution is 800 by 600.

One method of getting help is to click on various areas of this bitmap.

If the position misses the marks you should be able to drag thewindows to this position.

For most applications you should not have to move the upper calculator window once positioned.  The lower window has been positioned and programed for two convenient methods of expanding/changing the data viewed.  One way to see a larger span of vertical data is to

simply maximize the lower window by depressing the icon

or in Win95 the icon  [image]  .

When you need the calculator buttons again then restore the original size and position with the

icons.   or  [image]    .

The other method provided for is the use of the horizontal and vertical scroll bars which have been programmed to optimize coverage.

PLEASE NOTE!  The above windows position is based on a Resolution of at least 800 by 600.  You very likely will not be satisfied using this application in 640 by 480 resolution.  But if you need this lower resolution please let me know, I have plans for a VGA version but the look will be a little different.


Entering a matrix

How To Use The Calculator Dialog Form...

A matrix A,B,C,D,E,X,Y or Z can be created by entering the data in the Dlg array( spread sheet array ), entering the dimensions in 'row dimn' and 'col dimn'  then transferring the data to the chosen matrix name ( A, B,... ) by selecting the appropriate button.

To enter an element in row 2 column 3 go down to row labled 2 (row labels are on far left hand side) then go across to column labled 3 (column lables are across the top).  Use the tap key to move down, the shift-tab key to go up or merely click the appropriate cell with the mouse cursor.  At this point type in the real part of the element then drop down in the same column to the row labled +i immediately below this entry, here type in the imaginary part of the element if not zero.  If you must enter a value such as square root of 5 see Matrix Expression Evaluation or the function set

To save the Dlg array into the name A use the buttonDlg --> A.  You will use the button Dlg <--A to retrieve the matrix A when you need it.  Please note that matrices X,Y and Z are used by various procedures to return matrices of interest in that procedure so storage in these matrices can be temporary.

Some of the procedures performed by calculator buttons will require a matrix in the matrix named RHS you will see the transfer button for this matrix as well as those above.

An alternate method of entering matrices is via the control Matrix Expression Evaluation is as follows:

 	init("x+y+1"5,5)

will initialize the Dlg array with a 5X5 matrix with x+y+1 in row x and col y,

and

init("sin(x)*ln(y)",10,10)

or any expression of the form

init("expression in x,y",int,int)

can be used.

An example of the more general form of initializations follows:

init("expression in x,y'',8,8,''x'',''8'')

which constructs an upper triangular matrix of order 8x8.

Note if you need to save one of these init results you must use one of the transfer buttons.

Several examples are already entered in the drop-down list box control for Matrix Expression Evaluation

See Matrix Expression Evaluation  or Some examples  for more.


Transfer Buttons

The  buttons

Dlg->A, Dlg->B and etc. transfer the data showing in the calculator form (spread sheet like form) to the matrix A or B and so forth as appropriate.  The Dimensions of A, B and so on will be determined by the dimensions in row dimn and col dimn at the time of transfer.

The buttons Dlg <- A work in the reverse mode transferring the contents of A into the calculator form.

See Other Buttons


The matrix expression evaluator

Matrix operations such as inv(A), abs(B) or A*B+inv(trans(X)*X)*trans(X)*Y can be entered by typing them directly in the matrix expression edit box and then depressing the button Evaluate.  The functions inv, abs and trans(pose) must be typed in lower case.  The matrices A, B, & etc. must be typed in upper case.  Note if you need to use the matrix Dlg currently in the spread sheet use U in the expression as inv(U)*U and if you need RHS use R.

The operators {+,-,*,%+} are supported with the following definitions:

+ matrix or scalar addition,

- matrix or scalar subtraction,

* matrix multiplication or scalar multiplication a matrix,

%+ column-wise matrix concatenation

In addition there is support for the following special functions:

init, set, @, rows, cols, exrows, and excols

elmrowop

SeeSome Examples


Examples
Kexamples of the init() function

A Hilbert matrix of order 10x10 can be constructed by entering:

init("1/(x+y-1)",10,10)

A tri-diagonal matrix of order can be constructed by entering:

init("1+abs(x-y)",8,8,"x-1",x+1")

The following string typed into the matrix expression evaluator box will construct a special Vandermonde type matrix of order 8x8 where the ith jth element is i^(j-1).

init("x^(y-1)",8,8)

The general form of init is: init(expression_1 in x and y, integer value for row order, integer for column order, expression_2 in x , expression_3 in x  ).  Expression_1 is evaluated and placed in row x and column y.  Expression_2 is evaluated and used to determine in which column in row x does the first possible non-zero value occur in this row,  expression_3 gives the column after which all values are zero in this row.  This allows us to construct banded, triangular and diagonal matrices.

Solving Linear Systems Automatically

Basic Gaussian Elimination Example


Other Buttons

Solving linear systems Dlg*X=RHS

Gauss elimination

Eigen systems

Factor buttons

See also buttons Det(Dlg),Cond , Norm,CMPLX&REAL


Factors Button

The button Dlg->G Cholesky yields G / trans(G) the Cholesky factorization
(as in Dlg = G*trans(G) ) of a positive definite symmetric/Hermite matrix.  At termination Dlg=G, X=G and Y=trans(G); where G is lower triangular.  One can solve the system Dlg*X=RHS by using the Forward Sub button to solve X*Z=RHS and then using the Backward Sub button to solve trans(G)*X=Z.

The button  Dlg ->LU  yields the LU factorization of the Dlg matrix.  Where U is an upper triangular matrix and L is a unit lower triangular matrix.  At termination Dlg=U, Y=U and X=L.  You may solve LU*X=RHS by placing an appropriate right hand side in RHS, use the Forward Sub button to solve X*Z=RHS, then the Backward Sub button to solve Y*X=Z.  The solution will now be in X so that L will be lost if not saved elsewhere.

The button Dlg ->QR  yields the QR factorization of the Dlg matrix.  Q is orthogonal and R is upper triangular.  At termination Dlg=R, Y=R, X=Q, and Z=trans(Q)*RHS.  Backward Sub will solve R*X=trans(Q)*RHS but Q will be lost.

See Solving Linear Systems


Solving linear systems

The calculator provides buttons to perform automatically some standard methods of solving linear systems of equations such as gaussian elimination with complete pivoting (Complete pivot) or partial pivoting(Partial pivot) and the QR factorization method(QR solve).  Each of these requires a matrix in Dlg and a matrix in RHS.  Each will solve Dlg*X=RHS destroying what may be stored in X.

Example1.  For this example you should use the real mode (depress the key REAL )  Set Rowdimn to 10 and Coldimn to 1  Enter a column of ones (1) in the first column of the Dialog work sheet Dlg.  (You may tab to move down in any column.  You need not worry about what is in other columns after you change Coldimn to 1.)  Save this column to a matrix ,say E, via the transfer button Dlg ->E.  Enter an 10x10 Hilbert matrix in Dlg next (You may use the drop down list box labled Matrix Expression Evaluation to find init(1/(x+y-1),8,8), change the 8s to 10s and then depress Evaluate or depress the key board key Enter.)  If you enter this matrix by hand be sure to properly set the Rowdimn and Coldimn values- both to 10 in this case.  Save this matrix to ,say C, (Dlg ->C).  Go to the Matrix Expression Evaluation list box and type
 C*E   ( without the quotes ) and depress Evaluate or Enter.

The matrix C*E is a double precision representation (approximately 15 digit precision ) of the row sums of the Hilbert matrix.  In this example we intend to solve Hilbert*X=sum of rows.  Store the result (C*E) in matrix RHS. Remember the buttons here (Complete pivot, Partial pivot and etc. ) are used to solve Dlg*X = RHS so once you have stored RHS you must be sure to transfer C back to Dlg (Dlg <--C).

Now you are ready to use the any of the buttons Complete pivot, Partial pivot or QR Solve.  (Actually for this matrix you can also use any of the factorization methods as well ).The solution obtained by the method selected will be stored in matrix X and if a gaussian elimination method was chosen, the matrix U, of the LU decomposition, will be in Dlg.

As you will see the solution is not very accurate, of course the exact solution to the intended system is the matrix you put in E.  One measure of the (error easily obtained) goes as follows.  Evaluate the error E-X in the expression evaluation box, look it over and then depress the norm button.  You should get the value 1.1xxxxx e-02.

To get some measure of the expected quality of the solution assuming the answer is unknown, you might evaluate the condition number of the matrix C.  To do this transfer C back to Dlg and depress the button  COND.  You should get a number like 35.xxxxxe+12.  The condition number of C is so large any solution should be suspect.

Before you get the impression that this is the usual state of affairs try solving a nonsingular linear system of your devising or build a similar one from the example matrices in the drop down list box under Matrix Expression Evaluation, or use the matrix in A or B when the application opens.  Compare all the appropriate methods available, you should be able to find, among the matrices suggested in the list box above, examples that can be solved slightly better under one method than another.  There is one example where the LU Decomposition is slightly more accurate than partial pivoting.

See Example1B formore on this example.  See gauss elimination for the step by step approach.


Example1B

One of our problems in Example1 was that we intended to solve H*X=H*E with H the Hilbert matrix.  But C does not hold H exactly and RHS does not hold H*E exactly nor for that matter C*E exactly.  See what happens when the same steps taken in example1 are repeated where you replace RHS by a double precision representation of the exact H*E.  You can find this new RHS as column 5 in the file EXMP1.MAT.  (You can extract this column with the cols command, but as you will see there is very little need to do this.)  There is a very slight difference between C*E and this new RHS.  In fact the only difference between this column and C*E occurs in row 9, the more correct representation has an additional digit, the last digit, of 1.  You may simply add this additional digit to row 9 of RHS in NEW.MAT

TIME OUT!  If this move got confusing let me suggest the following method of opening the file EXAMP1.MAT while leaving the current application in place as NEW.MAT.  First minimize both views named NEW.MAT1 and NEW.MAT2 to icons at the bottom of the screen.  Go to the menu item file and then down to open.  There find the file in your directory named EXAMP1.MAT, hi-light this in the open dialog box and press Enter.  Two new views should display on the screen in the same way that the application opened originally.  I suggest you investigate column 5 to verify what was claimed above then minimize these two views or close them with their cooresponding close buttons or close menu items.  Then restore the two original views and now TIME IN.

The norm of C*E-RHS is only 1.e-15,but when you re-solve the system you should get a norm for E-X of 5.3xxxxe-03 compared to the 1.1xxxe-02 from example1.  Not good but two times better.  This is an extreme example demonstrating the limitations of even double precision.  The Hilbert matrix is well known in the literature for its high condition number.  Regardless of the application you use, the floating point solutions of this equation will suffer a similar fate as above.  The sensible approach is to use rational numbers, which I hope will be included in a revision coming soon.  Several of the professional applications have this feature now.

Because this application, MTRXCALC, is designed for small matrices the calculations are all done in complex arithmetic, however if you see real elements developing significant nonzero imaginary parts that is a clue to numerical degrading.  In this case check the result by an alternative method.

One further note.  If you place the hilbert matrix back into the Dlg and type U*inv(U) in the evaluation box, you will (upon evaluation ) get a matrix which is a poor approximation to the indentity matrix.  However if you check the condition number of this resulting matrix it will be close to 1.  Now repeatedly depressing the evaluate button or depressing enter will see improvement each time.  Ofcourse this does not improve the estimate of the inverse but merely demonstrates the numerical stability of computing with matrices having conditions numbers near 1.  NOTE IN THE ABOVE WE USED U TO REPRESENT THE Dlg MATRIX.  This can be done at any time.


More About

Ombudsman

This program is produced by a member of the Association of Shareware Professionals(ASP).  ASP wants to make sure that the shareware principle works for you.  If you are unable to resolve a shareware-related problem with an ASP member by contacting the member directly, ASP may be able to help.  The ASP Ombudsman can help you resolve a dispute or problem with an ASP member, but does not provide technical support for members products.  Please write to the ASP Ombudsman at 545 Grover Road, Muskegon, MI 49442-9427 USA, FAX 616-788-2765 or send a CompuServe message via CompuServe Mail to ASP Ombudsman 70007,3536.

MTRXCALC is distributed as shareware and if this application is useful to you please pay the $25.00 registration fee and get your registered copy. See Registration  I do hope that you find it useful and easy to use.  Besides registration entitles you to a free copy of the first update version for Windows95.  Also if you would like to see this application expanded in some area please drop a line to me via one of the addresses below.  Be sure to include your own return address in the case that further communication is necessary to clearly define your suggestion.

74471,2337 	on CompuServe or 74471,2337@compuserve.com	    on internet

Merritt Sugg

19 Vista Drive

Little Rock AR 72110	via US Mail

Support for your questions about how to use this application is provided by the means above.  Please do not register this application if you have hardware incompatibilities.

And Moore Still...

This application was put together using programs much like those expected of students in a second course of numerical analysis.  My original intention was to interest students in programming in C++ and in programming for their own PC.  I still hold that goal for I am sure many will find it rewarding and compelling.  Other reasons for continuing this project surfaced as time went on.

Some of the programs herein use very good classical algorithms near the state-of-art.  Other programs make heavy use of modules and thus lack some efficiencies that could be included.  In my experience State-of-art programming with near assembler language efficiency does not strongly motivate beginning programmers, however after they have begun writing their own programs they become more and more concerned with tuning and tweaking for performance.

All the routines in this application were built by the author and are based on his own number classes.  Partly because of generalization that are planned for the future, but partly due to the fact that they were developed to teach programming in C++.  Because the matrices here are small all calculations are done in complex double precision.  The time penalty appears to be 15% or less, round off error penalty is dependent on the procedure.

The accuracy and precision of these routines and final results is hopefully demonstrated by some of the examples.  I have found in these examples that this application compares favorably with MapleV Release 3 using Digits:=16.


init

The matrix expression evaluator can also be used to initialize a matrix as in

init("sqrt(2)",5,5,"x","x")

which will construct a diagonal matrix in the calculator form with root 2 on the main diagonal.  See Entering a Matrix

The general form of init is: init(expression_1 in x and y, integer value for row order, integer for column order, expression_2 in x , expression_3 in x  ).

Expression_1 is evaluated and placed in row x and column y.  Expression_2 is evaluated and used to determine in which column in row x does the first possible non-zero value occur in this row,  expression_3 gives the column after which all values are zero in this row.  This allows us to construct banded, triangular and diagonal matrices as you see above.


set

Typing the following into the evaluation control

set("ln(x)",8.7)

will initialize the element in row 8 and column 7 to ln((x).

The general form of set is:

set(expression, x,y)

Where expression is an algebraic expression in x, y, and the usual calculator
functions such as sin, cos, log, exp,acos,atan,...etc.  While x is an integer
denoting the row index and y the column index.


@

The matrix expression evaluator can also be used as a complex scalar calculator to evaluate elementary expressions.  To do so, prefix the expression by @ as in @sin(pi/4)^4.  The results will appear in the Calculator register.  If it is more convenient you can type expressions directly in the real or imaginary part of the scalar calculator registers, such as sqrt(5) for example.


rows

By typing rows(1,3..5,8,9) in the Matrix Expression Evaluation control and then depressing execute, you construct a new Dlg matrix comprised of the following rows of the the orginal Dlg:	1,3,4,5,8,9.

In general you must type row or rows with an argument list of integers seperated by commas or double periods.  If an integer is preceded by a comma or is the first integer in the list, then that row will be included in the rows of the new Dlg.  If an integer k is preceded by a pair of periods then all the rows since the last added row up to and including row k will be added.  The row dimension of the new matrix will changed appropriately


cols

The function cols is analogus to the function rows. By typing cols(1,3..5,8,9) in the Matrix Expression Evaluation control and then depressing execute, you construct a new Dlg matrix comprised of the following columns of the the orginal Dlg:	1,3,4,5,8,9.

In general you must type col or cols with an argument list of integers seperated by commas or double periods.  If an integer is preceded by a comma or is the first integer in the list, then that column will be included in the columns of the new Dlg.  If an integer k is preceded by a pair of periods then all the columns since the last added column up to and including column k will be added.  The column dimension of the new matrix will changed appropriately.

If one would like to find a basic solution cooresponding to a basis chosen form any, say m, columns of a given matrix as is common in linear programming then the cols operation is useful.  To be more specific given the system Ax=b with A of order m by n with m<n and rank(A)=m, use cols to construct a matrix B using any m columns of A and then solve Bx=b by any method appropriate.  The same applies to constructing a linear model X=Y for solution by least squares.  Here A is of order n by m with n>m, select p columns of A to describe your model place in X and insure that rank(X)=p, then type inv(transpose(X)*X)*transpose(X)*Y in the matrix expression evaluator matrix expression evaluator to obtain the solution.


exrows

You can exchange any two rows in the Dlg matrix using the function exrows( ).  For example exrows(3,5) will exchange row 3 and row 5.

The function excols( ) works in the same way.l


elmrowop

The function elmrowop performs the elementary row operation of replacing one row ,say row j, with row j + c* row k.  For example elmrowop(3,5) will replace row 3 by row3+c*row5, where c is the current content of the scalar calculator register.  To enter a value into this register you type it in directly in the register window (edit control) or use the @ function


QR Step button

The button QR_Step activates a sequence of QR factorizations of the matrix in the Dialog Box Dlg.  The number in the sequence of steps is proportional to the order of the matrix.  The full number of steps may not be performed if convergence criterion is met along the way. This algorithm can be re-applied to the previous result if convergence is not adequate.  Transformation to Hessianberg form is automatic so using the HESS button is not required.

This is a high level method in that the algorithm uses modules at the many steps along the way.  Thus it is relatively slow.  The accuracy is respectable for real matrices and marginal for complex.  Approximate eigenvectors are computed as well making the procedure even slower.

 The method for determining the eigenVectors is the unstable method often seen in undergraduate courses of solving

(A-σI)v=0

in which σ is an approximate eigenvalue and thus the system is very ill conditioned.  This method is  un reliable and especially so in the complex case and is offered AS IS only for edification.  The first updated version will have a more stable method.  Having warned you about this I will now say that it is not as poor a performer as it sounds for general use within the reals.

See  Eigen_systems


Hess button

See  Eigen_systems


Complex/Real buttons

The two buttons labled CMPLX or REAL simply toggle the display to allow single cell presentation in the REAL case or double cell in CMPLX.  Regardless of the presentation mode all calculations are done in complex arithmetic


Cond button

This button computes the condition number of the matrix Dlg using the 1-norm.
It returns 1-norm(Dlg)*1-norm(inv(Dlg))


Eigen systems

The Power button performs a sequence of high level applications of the inverse power method on the matrix in Dlg using the matrix in RHS as the initial vector.  The default RHS is a column of ones.  The vector in RHS is updated each time Power is depressed while Dlg is unchanged.  Thus you may repeat this operation several times to improve the estimate.  The RHS yields the eigenvector estimate, and each element of the column matrix in X is an estimate of the eigenvalue with largest magnitude.

The HESS button performs Haussholder reflections on Dlg until it is upper Hessenberg.

The QR Step button performs the qr algorithm on Dlg,  The results after a number of steps proportional to the dimension of Dlg are presented in the Dlg .  The approximate eigenvalues are on the main diagonal of Dlg and the corresponding approximate eigenvectors are in Y.  Please see QR Step


Gaussian Elimination

You can perform gaussian elemination and similar methods based on elementary row operations using step by step calls of exrows andelmrowop functions.  The augmented matrix can be constructed with the %+ operator.

As an example of this tedious but sometimes informative alternative to the automatic methods provided here, start with matrix that is loaded in A with you first open MTRXCALC.  Our intention here is to find the inverse of the submatrix of A formed from the first three rows and columns.  You can use the functions rows and cols  to do this.  Typing rows(1..3) in the Matrix Expression Evaluation control (or finding it in the drop down list box ) will create a submatrix of 3 rows by 4 colulmns using the first three rows of A.  Save this to A  Dlg-->A and then type (or find in the list box ) cols(1..3) .  Save this to A also so that now you have the desired 3 by 3 in A.

To construct the 3 by 3 Identity matrix we can use the init  function and type init(1,3,3,x,x)in the evaluator control.  Save this result to B.

To build the augmented matrix A|I we will use the %+ operator and simply type A%+B in the same evaluator control.  Save this in C in case you need to start again.

As a first step in a follow along mode we will divide the first row by 5, to do so type 1/5 into the real part of the calculator register (I will often refer to this register as the scalar calculator register).  Now type elmrowop(1) in the evaluator control hit enter and this will multiply row 1 by 1/5.  The next step is performed by typing -1 in the scalar register and then typing elmrowop(2,1) followed by enter hereby subtracting row 1 from row 2 and putting the result in row 2.  This should finish our work with column one.

For column two the sequence is

1/4 in the scalar register

elmrowop(2)

-2 in the scalar register

elmrowop(3,2)

I will not finish this example but I would like to note one advantage this tedious approach offers.  In the event that a near-zero value occurs at some step which you know should be replaced by an exact zero, then you can do so; something much harder to do in compiled code.  Another advantage is that (m x n) matrices of rank m, m<n, (occuring in linear programming ) can be solved for some chosen basis.


Det(Dlg)

This button calculates or retrieves the determinant of Dlg.  If you have performed any of several factorization or triangular methods the determinant of the matrix is stored and retrieved on this command.  If not, it will be calculated directly.  The default value is (-12345678) indicating an invalid value


Norm

This button calculates the 1-norm (induced norm) of Dlg.


Registration & License

This product is shareware and you are licensed to freely distribute the files provided herewith provided you do so free-of-charge.  You are licensed to use this product for evaluation of its usefulness.  After 21 days of trial you should either discontinue use or pay $25.00 for a registered copy.  Registration entitles you to a free registered copy of the first upgrade version for Windows 95 as well as a registered personal copy of this application with serial number, manual and any bug repairs as of the date submitted.  See next upgrade

( You may use the WinHelp print feature to print a copy of this topic )

MTRXCALC Registration Order Form

Payments must be in US dollars drawn on a US bank, or you

can send international postal money orders in US dollars.  Send the payment and this order form to Merritt Sugg, Little Rock, AR 72210.

An alternate form of ordering with the CompuServe's Software Registration Service may be in place by the time you read this.

Enter  GO SWREG and follow the menus.

But at this moment I prefer the direct US Mail approach

Single Copy	$25.00 each  _______________

Additional copies with this order

______copies	$12.00 each  _______________

Total payment	______________

Distribution disk  ______3.5"  ______5.25.

Version  WIN32s_____, WinNT3.5x_____, Windows95_____( Select one )

Name:	______________________ Date:________________

Company: 	_______________________________________

Street Address	_______________________________________

City, State, Zip:	_______________________________________

Country:	_______________________________________

(There is a $5.00 shipping charge to Canada and $7.00 elsewhere outside the USA)

Electronic Mail address: ________________________________


drag

Dragging a window

by placing the mouse cursor on the title bar, holding down the right mouse button and dragging the window into the desired position.


LU Factors

There are several variations provided of the LU factorization of a matrix say A.

The Dlg-->LU button decomposes as in A=L*U where L is a lower triangular matrix with units on the main diagonal.  The matrix U here is upper triangular.

The Partial pivot button decomposes as B=L*U where B=A except for possible row exchanges

The Complete pivot button decomposed as B=L*U where B=A except for possible row and/or column exchanges


upgrade

The first upgraded version of this application will have the minimum of the following:

 any revisions required to allow this application to run properly on

the first release of  Windows 95.

 a more stable method of obtaining approximate eigenvectors

 three or more of the following revisions or additions:

the single value decomposition,

availabilty of several matrix norms,

option to calculate in double precision real field mode,

option to calculate in rational field mode,

display options of real, complex, long display or short display,

larger matrices ,

direct entry of expressions in spread sheet,

dynamic data exchange with MS Excel and Quattro Pro,

copy and paste features.

The order of the maximum matrix which can be viewed and the size of the spread sheet will be determined by feed -back from you.  Some alternatives are matrices displayed in one, two or four page displays or perhaps with tabbed dialogs.